<template>
    <div>
        <Card shadow>
            <Row>
                <Col span="12">
                    <Divider>磁盘</Divider>
                    <p v-for="(d,i) in serverData.disk" :key="i">
                        <span>盘符路径:{{d.path}}</span>&nbsp;&nbsp;
                        <span>总大小:{{d.totalSpace}}</span>&nbsp;&nbsp;
                        <span>剩余存储空间:{{d.freeSpace}}</span>&nbsp;&nbsp;
                        <span>实际可用空间:{{d.usableSpace}}</span>&nbsp;&nbsp;
                    </p>
                </Col>
                <Col span="12">
                    <Divider>系统</Divider>
                    <p>操作系统的版本:{{serverData.os.os}}</p>
                    <p>操作系统物理内存已用的空间为:{{serverData.os.physicalFree}}</p>
                    <p>操作系统总物理内存:{{serverData.os.physicalTotal}}</p>
                    <p>操作系统物理内存的空闲空间为:{{serverData.os.physicalUse}}</p>
                    <p>获得线程总数:{{serverData.os.totalThread}}</p>
                    <p>JVM内存的空闲空间为:{{serverData.os.vmFree}}</p>
                    <p>JVM最大内存空间为:{{serverData.os.vmMax}}</p>
                    <p>JVM总内存空间为:{{serverData.os.vmTotal}}</p>
                    <p>JVM内存已用的空间为:{{serverData.os.vmUse}}</p>
                </Col>
            </Row>
            <Row>
                <Col span="12">
                    <Divider>内存</Divider>
                    <p>总内存(Total RAM):{{serverData.mem.totalRAM}}</p>
                    <p>可用内存(Available　RAM):{{serverData.mem.availableRAM}}</p>
                </Col>
                <Col span="12">
                    <Divider>Cpu</Divider>
                    <p>过程CPU负载:{{serverData.cpu.processCpuLoad}}</p>
                    <p>系统CPU负载:{{serverData.cpu.systemCpuLoad}}</p>
                    <p>过程CPU时间:{{serverData.cpu.processCpuTime}}</p>
                </Col>
            </Row>
        </Card>
    </div>
</template>

<script>
    import {serverInfo} from '@/api/server';

    export default {
        name: "Server",
        data() {
            return {
                serverData: {},
            }
        }, created() {
            this.getServerInfo();
        },
        methods: {
            async getServerInfo() {
                let res = await serverInfo();
                if (res.success) {
                    this.serverData = res.result;
                }
            }
        }
    }
</script>

<style scoped>

</style>
